<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>
<!-- 自定义指令 -->
<body>
    <div id="app">

    </div>

    <script>
        /* 全局指令 */
        Vue.directives("focus",{
            inserted(el){
                el.focus()
            }
        })
        new Vue({
            el: '#app',
            data: {

            },
            methods: {

            },
            // 局部指令
            directives:{
                focus:{
                inserted(el){
                    el.focus()
                }
                }
            }
        })
    </script>
</body>

</html>